//
//  main.cpp
//  P1007
//
//  Created by 洋犀利 on 2019/10/17.
//  Copyright © 2019 洋犀利. All rights reserved.
//

#include <iostream>
using namespace std;
#include<cstdio>
#include<algorithm>

const int size = 5005;
int a[size];
int main()
{
    int n,l,p,maxv=0,minv=0;
    cin>>l>>n;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&p);
        maxv=max(maxv,max(l-p+1,p));
        minv=max(minv,min(l-p+1,p));
    }
    printf("%d %d",minv,maxv);
    return 0;
}
